import {request} from '@umijs/max';
import * as API from "@/services";
import {AccessLogPageQueryParams} from "@/services";


/** 访问记录 分页检索请求 */
export async function queryAccessLogs(params: API.AccessLogPageQueryParams): Promise<API.RespPageResult<API.AccessLog>> {
  return request('/api/v1/access', {
    params,
  });
}

/** 访问记录 详情请求 */
export async function queryAccessLog(bizId: API.EntityId): Promise<API.RespResult<API.AccessLog>> {
  return request(`/api/v1/access/${bizId}`);
}

/** 访问记录 创建请求 */
export async function createAccessLog(entity: API.AccessLog_Create): Promise<API.RespResult<any>> {
  return request(`/api/v1/access`, {
    method: 'POST',
    data: entity,
  });
}



/*
/!** 访问记录 修改请求 *!/
export async function modifyAccessLog(entity: API.AccessLog_Modify): Promise<API.RespResult<any>> {
  return request(`/api/v1/access/${entity.id}`, {
    method: 'PUT',
    data: entity,
  });
}

/!** 访问记录 修改(部分)请求 *!/
export async function patchAccessLog(entity: API.AccessLog_Patch): Promise<API.RespResult<any>> {
  return request(`/api/v1/access/${entity.id}`, {
    method: 'PATCH',
    data: entity,
  });
}

/!** 访问记录 删除请求 *!/
export async function deleteAccessLog(bizId: API.EntityId): Promise<API.RespResult<any>> {
  return request(`/api/v1/access/${bizId}`, {
    method: 'DELETE',
  });
}

/!** 访问记录 批量删除请求 *!/
export async function deleteAccessLogs(bizIds: API.EntityId[]): Promise<API.RespResult<any>> {
  return request(`/api/v1/access`, {
    method: 'DELETE',
    data: {
      ids: bizIds,
    },
  });
}
*/
